﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NoodlesCms.Configuration;
using Noodles.Core.Repositories;
using Noodles.Core.Model;

namespace NoodlesCms.Controllers
{
    public class PostController : Controller
    {
        //
        // GET: /Post/
        public INoodlesRepository noodlesRepo { get; set; }
        public ActionResult Index()
        {
            return View();
        }
       
        //public ActionResult Details(int id, string SeoTitle)
        //{
        //    return View();
        //}
        
        [SEOToId]
        public ActionResult Details(int id,string Title)
        {
             IEnumerable<BlogPost> post = noodlesRepo.GetBlogFromTitle(Title);            
             return View(post);
        }
        [ChildActionOnly]
        public ActionResult Comments(int BlogID)
        {
            IEnumerable<Comments> comments = noodlesRepo.GetCommentsFromBlogID(BlogID);
            return PartialView(comments);
        }
       
    }
}
